//#define __DEBUG__
// by Xeno
#define THIS_FILE "fn_converttime.sqf"
#include "x_setup.sqf"

private ["_timelong", "_mod", "_days", "_mod2", "_hours", "_mod3", "_minutes", "_seconds"];
_timelong = _this;
_mod = _timelong % 86400;
_days = if (_mod == _timelong) then {0} else {floor(_timelong / 86400)};
_mod2 = _mod % 3600;
_hours = if (_mod2 == _mod) then {0} else {floor(_mod / 3600)};
_mod3 = _mod2 % 60;
_minutes = if (_mod3 == _mod2) then {0} else {floor(_mod2 / 60)};
_seconds = round _mod3;
_days = if (_days < 10) then {"0" + (str _days)} else {str _days};
_hours = if (_hours < 10) then {"0" + (str _hours)} else {str _hours};
_minutes = if (_minutes < 10) then {"0" + (str _minutes)} else {str _minutes};
_seconds = if (_seconds < 10) then {"0" + (str _seconds)} else {str _seconds};
(_days + "d " + _hours + "h " + _minutes + "m " + _seconds + "s")